<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">搜索Github用户</h3>
    <div>
      <input
        type="text"
        placeholder="请出入用户名"
        v-model="keyword"
      />&nbsp;<button @click="seach">搜索</button>
    </div>
  </section>
</template>

<script>
import axios from "axios";
export default {
  name: "Search",
  data() {
    return {
      keyword: "",
    };
  },
  methods: {
    seach() {
      axios.get(`https://api.github.com/search/users?q=${this.keyword}`).then(
        (res) => {
          this.$bus.$emit("user-list", res.data.items);
        },
        (err) => {
          err.message;
        }
      );
    },
  },
};
</script>

<style scoped>
</style>